#include "ConfigurationSys.h"

ConfigurationSys::ConfigurationSys()
{
}

lvVoid ConfigurationSys::Create()
{
	m_pInstance = new ConfigurationSys;
}

ConfigurationSys::~ConfigurationSys()
{
}

lvVoid ConfigurationSys::_Load()
{
	FILE *_pFile = _tfopen(CONFIGURATIONFILENAME, _S("rt"));

	lvString _strCurSection;

	lvChar _chBuf[256];
	lvChra _chBuf2[256];

	while(!feof(_pFile))
	{
		_fgetts(_chBuf, 256, _pFile);
		if(_chBuf[0] == _S("["))
		{
			lvInt _iStrLen = _tcslen(_chBuff);
			memcpy(_chBuf2, _chBuf + 1, _iStrLen - 2);
			_strCurSection.assign(_chBuf2);
		}
		else
		{
			lvChar *_chFound = _tcschr(_chBuf, '=');
			if (_chFound==0)
			{
				IErrorHandlingSys::Error(lvString(_S("Error parsing configuration file!")), SUBSYSTEM_ID_DEFAULT);
				return;
			};
			//CCSParameter *_newParam = new CCSParameter(
		};
	};
}

lvVoid ConfigurationSys::_Save()
{
}

CCSParameter &ConfigurationSys::_Parameter(const lvString &cstrPath)
{
	return CCSParameter(PT_INTEGER);
}
